package com.example.myapplication;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class score extends AppCompatActivity {

    private  static final String TAG="score";
    private TextView score1;
    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_score);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        score1 = findViewById(R.id.v2);
    }
    public  void click(View bt){

        Log.i(TAG,"click:11111111111111");
        String s=(String) score1.getText();
        int ints=Integer.parseInt(s);
        if(bt.getId()==R.id.bt1){
            ints+=3;
        } else if (bt.getId()==R.id.bt2) {
            ints+=2;
        }else if (bt.getId()==R.id.bt3) {
            ints+=1;
        }
        if(bt.getId()==R.id.bt4){
            ints=0;
        }
        score1.setText(String.valueOf(ints));

    }
}